package com.module.antiFake.main;
import org.apache.commons.lang.StringUtils;

import com.module.antiFake.schedule.AntiFakeWarnSchedule;
import com.util.PropertiesUtil;

public class AntiFakeMain {
	public static void main(String[] args) {
		try {
			int intervalSecond = getIntervalSecond();
			//启动预警扫描定时器;
			AntiFakeWarnSchedule.getInstance().start(60, intervalSecond);
		} catch (Exception e) {
			e.printStackTrace();
		}
//		
//		try {
//			new AntiFakeStartService().messageReceived();
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
	}

	/**
	 * 取得定时器执行间隔时间;
	 * @return
	 */
	private static int getIntervalSecond() {
		String warnIntervalSecondStr =  PropertiesUtil.getString("warnIntervalSecond");
		int result = 10*60;
		if(StringUtils.isNotBlank(warnIntervalSecondStr)){
			try{
				result = Integer.parseInt(warnIntervalSecondStr);
				//最少不能低于2分钟扫一次;
				if(result<=120){
					result = 120;
				}
			}catch (Exception e) {
				e.printStackTrace();
			}
		}
		return result;
	}
}
